import request from '@/utils/request';

/**
 * 保存机构信息
 * @param {*} params
 */
export const save = params => {
  return request({
    url: '/admin/adminOrg/add',
    data: params,
    method: 'post'
  });
};

/**
 * 更新机构信息
 * @param {*} params
 */
export const update = params => {
  return request({
    url: '/admin/adminOrg/update',
    data: params,
    method: 'post'
  });
};

/**
 * 获取机构详情
 * @param {*} id
 */
export const get = id => {
  return request({
    url: '/admin/adminOrg/get',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 删除机构信息
 * @param {*} id
 */
export const remove = id => {
  return request({
    url: '/admin/org/delete',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 分页查询机构信息
 * @param {*} params
 */
export const page = params => {
  return request({
    url: '/admin/adminOrg/page',
    data: params,
    method: 'post'
  });
};

/**
 * 获取机构树
 * @param {*} id
 */
export const tree = id => {
  return request({
    url: '/admin/org/tree',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 获取机构树列表
 * @param {*} id
 */
export const trees = id => {
  return request({
    url: '/admin/adminOrg/trees',
    data: {
      id: id
    },
    method: 'post'
  });
};

/**
 * 获取省区域列表
 * @param {*} id
 */
export const getProvinceAreaMap = id => {
  return request({
    url: '/admin/area/getArea',
    method: 'post'
  });
};
/**
 * 获取区域列表
 * @param {*} id
 */
export const getAreaMap = id => {
  return request({
    url: '/admin/area/getArea?parentId=' + id,
    method: 'post'
  });
};
/**
 * 获取区域树形列表
 * @param {*} params
 */
export const getAreaTree = params => {
  return request({
    url: '/admin/area/getAreaTree',
    method: 'post'
  });
};
